package com.syl.starter.itools.base.constants;

/**
 * 正则常量类
 *
 * @author syl
 * @create 2018-11-06 10:17
 **/
public class RegexConstant {
    /**
     * 示例 ： (?<=\()\w+(?=\)) 零宽断言使用 提取()表达式中内容的正则
     */

    /**
     * 剔除空字符正则
     */
    public static final String TRIM_REGEX = "\r|\n|\\s";
    /**
     * 匹配纯英文
     */
    public static final String MATCH_ENGLISH_REGEX = "[a-zA-Z]";
    /**
     * 匹配国内电话
     */
    public static final String MATCH_TELEPHONE_CHINA = "\\d{3}-\\d{8}|\\d{4}-\\d{8}";
    /**
     * 匹配国内18和15位身份证
     */
    public static final String MATCH_ID_CARD = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$";
    /**
     * 匹配国内18位身份证
     */
    public static final String MATCH_ID_CARD_CHINA_18 = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";
    /**
     * 匹配国内15位身份证
     */
    public static final String MATCH_ID_CARD_CHINA_15 = "^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$";
    /**
     * 匹配国内邮编
     */
    public static final String MATCH_POSTCODE_CHINA = "[1-9]\\d{5}(?!\\d)";
    /**
     * 匹配手机号格式
     */
    public static final String MATCH_PHONE = "1[3456789]\\d{9}";
    /**
     * 匹配邮箱格式
     */
    public static final String MATCH_EMAIL = "^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$";
    /**
     * 匹配qq号
     */
    public static final String MATCH_QQ = "^[1-9][0-9]{4,11}$";
    /**
     * 匹配中文
     */
    public static final String MATCH_CHINESE_REGEX = "\\u4e00-\\u9fa5";
    /**
     * 匹配数字
     */
    public static final String MATCH_NUMBER = "\\d";
    /**
     * 匹配int 类型
     */
    public static final String MATCH_INT = "^[+-]?\\d{1,9}$";
    /**
     * 匹配long 类型
     */
    public static final String MATCH_LONG = "^[+-]?\\d{1,18}$";
    /**
     * 匹配 BigInteger 类型
     */
    public static final String BIG_INTEGER = "^[+-]?\\d+$";
    /**
     * 匹配 float 类型
     */
    public static final String MATCH_FLOAT = "^[+-]?\\d?\\.\\d{1,6}$";
    /**
     * 匹配 double 类型
     */
    public static final String MATCH_DOUBLE = "^[+-]?\\d?\\.\\d{1,15}$";
    /**
     * 匹配 BigDecimal 类型
     */
    public static final String MATCH_BIG_DECIMAL = "^[+-]?\\d?\\.\\d+$";
    /**
     * 匹配 boolean 类型 严格模式
     */
    public static final String MATCH_STRICT_BOOLEAN = "^(true|false)$";
    /**
     * 匹配 boolean 类型 宽松模式
     */
    public static final String MATCH_LOOSE_BOOLEAN = "^(true|false|0|1)$";
    /**
     * 匹配 yyyy-MM-dd HH:mm:ss 类型的日期格式
     */
    public static final String DATE_4Y2M2D2H2M2S = "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\\d|3[0-1]) ([0-1][0-9]|2[0-3])(:([0-5][0-9])){2}$";
    /**
     * 匹配 yyyy-MM-dd 类型的日期格式
     */
    public static final String DATE_4Y2M2D = "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\\d|3[0-1])$";

}
